package org.clockworkmages.games.anno1186.model.situation;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;

import org.clockworkmages.games.anno1186.model.option.GenericOption;
import org.clockworkmages.games.anno1186.model.option.Option;

//@XmlRootElement(name = "situation")
public class GenericSituation
		extends Situation implements ExplorableGameEvent {

	// exploration event situation only:

	/**
	 * Situation pool (typically: a location, such as Forest or Desert) where
	 * this situation can potentially occur.
	 */
	private String situationPool;

	/**
	 * Condition that needs to be met for this situation to be available for
	 * picking when exploring the given situationPool/location.
	 */
	private String condition;

	/**
	 * Probability of this situation. This is not a percentual value, it just
	 * makes this situation more or less probable compared to other explorable
	 * situations.
	 */
	private int probability;

	@XmlElement(name = "option")
	public List<GenericOption> getGenericOptions() {
		List<GenericOption> genericOptions = new ArrayList<GenericOption>();
		for (Option option : getOptions()) {
			if (option instanceof GenericOption) {
				genericOptions.add((GenericOption) option);
			}
		}
		return genericOptions;
	}

	public void setGenericOptions(List<GenericOption> options) {
		this.getOptions().clear();
		this.getOptions().addAll(options);
	}

	@XmlAttribute
	public String getAreaType() {
		return situationPool;
	}

	public void setSituationPool(String situationPool) {
		this.situationPool = situationPool;
	}

	@XmlAttribute
	public String getCondition() {
		return condition;
	}

	public void setCondition(String condition) {
		this.condition = condition;
	}

	@XmlAttribute
	public int getProbability() {
		return probability;
	}

	public void setProbability(int probability) {
		this.probability = probability;
	}

}
